﻿
************************************************************************************************
* Constructing data set to "Public Health Policy At Scale.."
************************************************************************************************

************************************************************************************************
* Full population born 1970-2014 from birth registries
* Include gender at birth
*************************************************************************************************


global rawStata "X:\Data\Workdata\707116\Stata"
global temp2 "X:\Data\Workdata\707116\ChildVax\02_temp\Nov2019" 

set mem 2g
set more off
set linesize 255


clear all

use $temp2\births19732014.dta, clear  
bysort pnr: g i=_n 
keep if i==1
drop i
tempfile t1 
save `t1' 

use pnr koen using  $rawStata\ftbarn2018, clear 
tab koen

gen p_match = !regexm(pnr,"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]")
replace pnr = "" if pnr !="" & p_match

drop if pnr==""

drop p_match

merge 1:1 pnr using `t1' 

tab byear _merge
drop if _merge==1 
drop _merge

g 		female=(koen==2)
replace female=. if koen==. 
tab female, mi


save $temp2\births19732014v2.dta, replace 



